// Common/StringConvert.h

#ifndef __COMMON_STRING_CONVERT_H
#define __COMMON_STRING_CONVERT_H

namespace Common
{
namespace String
{

CString MultiByteToUnicodeString(const CStringA &srcString, UINT codePage = CP_ACP);
CStringA UnicodeStringToMultiByte(const CString &srcString, UINT codePage, char defaultChar, bool &defaultCharWasUsed);
CStringA UnicodeStringToMultiByte(const CString &srcString, UINT codePage = CP_ACP);


inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString)
  { return unicodeString; }
//inline const CString& GetUnicodeString(const CString &unicodeString)
  //{ return unicodeString; }
inline CString GetUnicodeString(const CStringA &ansiString)
  { return MultiByteToUnicodeString(ansiString); }
inline CString GetUnicodeString(const CStringA &multiByteString, UINT codePage)
  { return MultiByteToUnicodeString(multiByteString, codePage); }
inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString, UINT)
  { return unicodeString; }
inline const CString& GetUnicodeString(const CString &unicodeString, UINT)
  { return unicodeString; }

inline const char* GetAnsiString(const char* ansiString)
  { return ansiString; }
inline const CStringA& GetAnsiString(const CStringA &ansiString)
  { return ansiString; }
inline CStringA GetAnsiString(const CString &unicodeString)
  { return UnicodeStringToMultiByte(unicodeString); }
inline CStringA GetAnsiString(const wchar_t* unicodeString)
{ return UnicodeStringToMultiByte(unicodeString); }



inline const char* GetOemString(const char* oemString)
  { return oemString; }
inline const CStringA& GetOemString(const CStringA &oemString)
  { return oemString; }
inline CStringA GetOemString(const CString &unicodeString)
  { return UnicodeStringToMultiByte(unicodeString, CP_OEMCP); }


  inline const wchar_t* GetSystemString(const wchar_t* unicodeString)
    { return unicodeString;}
  inline const CString& GetSystemString(const CString &unicodeString)
    { return unicodeString;}
  inline const wchar_t* GetSystemString(const wchar_t* unicodeString, UINT /* codePage */)
    { return unicodeString;}
  inline const CString& GetSystemString(const CString &unicodeString, UINT /* codePage */)
    { return unicodeString;}
  inline CString GetSystemString(const CStringA &multiByteString, UINT codePage)
    { return MultiByteToUnicodeString(multiByteString, codePage);}
  inline CString GetSystemString(const CStringA &multiByteString)
    { return MultiByteToUnicodeString(multiByteString);}

#ifndef UNDER_CE
CStringA SystemStringToOemString(const CString &srcString);
#endif

}
}

#endif
